#pragma once
#include "common.h"
#include "common/type.h"

namespace qklog {

uHandle WinApi_GetStdHandle();

class logger {
public:
    virtual void write_log(qklog::level lvl, const std::string& fmt, ...) = 0;
    static std::string get_default_log_prefiex(qklog::level lvl);
public:
    virtual ~logger(){};
};


class stdout_logger final : public logger {
public:
    static std::unordered_map<qklog::level, uint32> colors;

    stdout_logger() : stdout_handler(qklog::WinApi_GetStdHandle())
    {}
    virtual ~stdout_logger() {}
    void write_log(qklog::level lvl, const std::string& fmt, ...);
private:
    void print_range(const char* buf, int l, int r, uint32 color);
    uHandle stdout_handler;
};


class file_logger final : public logger {

};


};


